#include "callbacks.h"

Playing *S_Playing::playing = NULL;

void S_Playing::init(Playing *scene)
{
    S_Playing::playing = scene;
}

void cursor_pos_callback(GLFWwindow *window, double xpos, double ypos)
{
    S_Playing::playing->cursor_pos_callback(xpos, ypos);
}
void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
{
    S_Playing::playing->mouse_button_callback(button, action, mods);
}

void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
{
    S_Playing::playing->key_callback(key, scancode, action, mods);
}

void S_Playing::setcallbacks()
{
    glfwSetCursorPosCallback(playing->getWindow(), cursor_pos_callback);
    glfwSetMouseButtonCallback(playing->getWindow(), mouse_button_callback);
    glfwSetKeyCallback(playing->getWindow(), key_callback);
}

void S_Playing::delcallbacks()
{
    glfwSetCursorPosCallback(playing->getWindow(), NULL);
    glfwSetMouseButtonCallback(playing->getWindow(), NULL);
    glfwSetKeyCallback(playing->getWindow(), NULL);
}